#include "algorithmdialogbase.h"

AlgorithmDialogBase::AlgorithmDialogBase(QWidget *parent, QString algorithm, QString algorithmMovie, QSize size) : QWidget(parent)
{
    this->setAlgorithm(algorithm, algorithmMovie, size);

    // 设置窗口为模态窗口
    this->setWindowModality(Qt::ApplicationModal);

    btnDoWork = new QPushButton(this);
    btnDoWork->setText(tr("开始执行算法"));
    btnDoWork->move(QPoint(100,100));

    connect(btnDoWork, &QPushButton::clicked, this, &AlgorithmDialogBase::sendOutput);
}

AlgorithmDialogBase::~AlgorithmDialogBase()
{

}

void AlgorithmDialogBase::sendOutput()
{
    execAlgorithm();
    emit doWork(this->strVector);
}

/*
 * 1.设置算法名称
 * 2.设置窗口标题
 */
void AlgorithmDialogBase::setAlgorithm(QString algorithm, QString algorithmMovie, QSize size)
{
    this->algorithm = algorithm;
    this->algorithmMovie = algorithmMovie;
    this->setWindowTitle(this->algorithm);
    this->resize(size);
}
